<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 除了对象类型的都是 obj.keys() obj.values() obj.entries()
      const hd = new Set(['hdcms', 'houdunren']);
      for (let key of hd.keys()) {
        console.log(key);
      }

      let map = new Map([
        ['name', 'zs'],
        ['age', 18],
      ]);
      for (let key of map.keys()) {
        console.log(key);
      }
      for (let [key, value] of map.entries()) {
        console.log(key, value);
      }

      // obj is not iterable,obj不是可迭代对象
      let hd1 = {
        name: 'zs',
        data: [1, 2, 2, 3],
      };
      for (let key of Object.keys(hd1)) {
        console.log(key);
      }
    </script>
  </body>
</html>
